<template>
  <a :href="styleColor.linkAdress" :style="styleColor" :target="styleColor.jumpMode">{{ styleColor.text }}</a>
</template>

<script>
export default {
  name: "WidgetHref",
  components: {},
  props: {
    value: Object
  },
  data() {
    return {
      options: {
        setup: []
      }
    };
  },
  computed: {
    transStyle() {
      let options = Object.assign({}, this.options.setup)
      options = Object.assign(options, this.options.position)
      return options;
    },
    styleColor() {
      return {
        position: "absolute",
        color: this.transStyle.color || "#fff",
        fontWeight: this.transStyle.fontWeight || "600",
        text: this.transStyle.text || "超链接",
        fontSize: this.transStyle.fontSize + "px" || "12px",
        letterSpacing: this.transStyle.letterSpacing + "em",
        background: this.transStyle.background,
        textAlign: this.transStyle.textAlign,
        width: this.transStyle.width + "px",
        height: this.transStyle.height + "px",
        left: this.transStyle.left + "px",
        top: this.transStyle.top + "px",
        zIndex: this.transStyle.zIndex + "px",
        linkAdress: this.transStyle.linkAdress,
        jumpMode: this.transStyle.jumpMode
      };
    }
  },
  watch: {
    value: {
      handler(val) {
        this.options = val;
      },
      deep: true
    }
  },
  mounted() {
    this.options = this.value;
  }
};
</script>

<style scoped lang="less">
a {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
</style>
